-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature] OAuth 로그인시 토큰 전달 방식 변경 #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| @Schema(description = "유저 ROLE") | ||
| String role | ||
| ) { | ||
| public static UserInfoResponseDto from(UUID userId, UserRole role) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of라는 네이밍이 더 적절하다고 생각했는데 재중님 생각은 어떠신가요
저의 경우는
of : 데이터 필드값으로 객체를 생성할 때
from : 특정 객체로부터 객체가 생성될 때
로 인자값으로 객체가 들어올 때 from을 사용중이라 재중님 의견을 여쭤보고 싶습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞아요 그 관점에서도 of가 더 적절한 것 같아요
제가 전부 from으로 시그니처를 만들어두고 구현해서 그렇습니다.. 수정할게요 감사합니다~~
| ACCESS(1000 * 60 * 30), | ||
| REFRESH(1000 * 60 * 60 * 24 * 7), | ||
| SIGNOUT(0); | ||
| ACCESS(Duration.ofMinutes(30)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duration 기억하겠습니다... 좋네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 코드가 엄청 깔끔해져서 좋더라구요
|
|
||
| private static ResponseCookie generateCookie(TokenType tokenType, String value) { | ||
| return ResponseCookie.from(TokenType.ACCESS.name(), value) | ||
| return ResponseCookie.from(TokenType.ACCESS.getDescription(), value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 from과 of 어떤게 적절할 지 의견나눠보면 좋을거 같아요!
|
|
||
| return ApiResponse.ok(HttpStatus.OK.value(), | ||
| accessToken.getValueWithPrefix(), | ||
| "유저 정보 응답 성공"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
두 메서드의 메세지가 같은데 어떤 의도가 있으신건지 궁금합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어 바로 수정했었습니다. 제가 놓쳤더라구요~~
| import java.util.UUID; | ||
|
|
||
| @Service | ||
| @Slf4j |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코드에 로깅 부분이 안보여서
이 부분도 제거해줘도 괜찮을 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 감사합니다
|
현재 로직이 추후 확장성 및 유지보수 측면에서 적합한 구조인지 의견 주시면 감사하겠습니다. 전 클래스 구조적으로 책임도 잘 나뉘어있고 코드도 의도와 논리가 명확하게 보여서 좋았습니다 토큰 타입 관련 리팩토링이 별거 없지만 최근 리팩토링 중에 가장 마음에 들어서 그런데 유심히 봐주세요~. |
- 로그인이 완료되면 엑세스 토큰과 리프레시 토큰은 서버에서 관리됨. - 쿠키에는 로그인 토큰이 설정되고 이를 활용해서 엑세스 토큰을 발급받을 수 있음.
7fcb3a0 to
6cfe14c
Compare
|



resolved :
📌 과제 설명
이를 해결하기 위해:
/success으로 리디렉션합니다./success으로 이동 시, 백엔드에 별도로 토큰 요청 API를 호출합니다.이 방법으로 리디렉션과 데이터 전달 문제를 해결하면서, 보안성을 유지할 수 있습니다.
👩💻 요구 사항과 구현 내용
OAuth 로그인 후 리디렉션 처리
/success경로로 리디렉션됩니다./success경로에 도달하면 토큰 요청을 위한 별도의 API를 호출합니다.쿠키에 로그인 토큰 저장
토큰 요청 API 구현
/api/auth/tokenAPI를 호출하여 액세스 토큰을 요청합니다.✅ PR 포인트 & 궁금한 점
현재 로직이 추후 확장성 및 유지보수 측면에서 적합한 구조인지 의견 주시면 감사하겠습니다.
토큰 타입 관련 리팩토링이 별거 없지만 최근 리팩토링 중에 가장 마음에 들어서 그런데 유심히 봐주세요~.